package club.mzywucai.blog.air_portal.controller;

import club.mzywucai.blog.air_portal.pojo.domain.JsonData;
import club.mzywucai.blog.air_portal.service.GetFileInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author mzywucai
 * @Description
 * @date 2019/6/2
 */
@RestController
public class ReceiveFileController {
    @Autowired
    GetFileInfoService getFileInfoService;

    /**
     * @Description 拿URI咯
     * @author mzywucai
     * @time 2019-06-03
     * @see
     * @return   java.lang.Object
     * @params  [fileCode, filePass]
     */
    @RequestMapping("/api/getFileURI")
    public Object getFIleURI(String fileCode, String filePass){
        JsonData json = getFileInfoService.getFileURI(fileCode, filePass);

        return json;
    }

    /**
     * @Description 检查文件存性和文件是否有密码
     * @author mzywucai
     * @time 2019-06-03
     * @see 
     * @return   java.lang.Object
     * @params  []
     */
    @RequestMapping("/api/checkExistenceAndHasPass")
    public Object checkFileExistenceAndHasPass(String fileCode){
        JsonData json = getFileInfoService.checkFileExistenceAndHasPass(fileCode);

        return json;
    }
}
